package com.ceba.test.base.dbdata.modules;
import com.ceba.base.dbdata.DataTableObject;
import com.ceba.base.dbdata.MysqlUtils;
public class LogDb {

	public static void init() throws Exception{
		//14-start
		DataTableObject g_backup=new DataTableObject("g_backup");
		g_backup.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		g_backup.addField("DATABASE_PATH", "varchar(500)", "DEFAULT NULL", "", "false");
		g_backup.addField("FILE_PATH", "varchar(500)", "DEFAULT NULL", "", "false");
		g_backup.addField("CREATE_USER", "varchar(500)", "DEFAULT NULL", "", "false");
		g_backup.addField("CREATE_TIME", "datetime", "DEFAULT NULL", "", "false");
		MysqlUtils.syncTableStructure(g_backup);
		//end
		
		//4-start
		DataTableObject cb_oplog=new DataTableObject("cb_oplog");
		cb_oplog.addField("ID", "varchar(32)", "NOT NULL", "", "true");
		cb_oplog.addField("LOG_TYPE", "int(4)", "NOT NULL", "", "false");
		cb_oplog.addField("OP_TYPE", "int(4)", "NOT NULL", "", "false");
		cb_oplog.addField("MESSAGE", "varchar(512)", "DEFAULT NULL", "", "false");
		cb_oplog.addField("ERROR_MESSAGE", "varchar(512)", "DEFAULT NULL", "", "false");
		cb_oplog.addField("CREATE_TIME", "date", "DEFAULT NULL", "", "false");
		cb_oplog.addField("CREATE_USER", "varchar(64)", "DEFAULT NULL", "", "false");
		cb_oplog.addField("CREATETIME", "varchar(64)", "DEFAULT NULL", "", "false");
		
		cb_oplog.addField("HASH_MESSAGE", "varchar(500)", "DEFAULT NULL", "日志的信息的Hash码", "false");
		MysqlUtils.syncTableStructure(cb_oplog);
		MysqlUtils.syncDateType("cb_oplog", "MESSAGE", "text");
		//end
		addIndex();
	}

	public static void addIndex() throws Exception {
		MysqlUtils.syncFieldIndex("cb_oplog", "LOG_TYPE");
	}
}
